package com.pro.util;


	import java.sql.Timestamp;
	import java.text.ParseException;
	import java.text.SimpleDateFormat;
	import java.util.Date;

	public class DateUtil {//日期和字符串转换的工具类
		static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		public static String dateToString(Date d) {
			return sdf.format(d);
		}
		public static Date stringToDate(String d) {
			try {
				return sdf.parse(d);
			} catch (ParseException e) {
				e.printStackTrace();
				return null;
			}
		}
		
		public static Timestamp DateToDate(Date d) {
				return Timestamp.valueOf(dateToString(d));
		}
}
